<?php
//declare (strict_types=1);

/**
 * @Description:
 * @Author: Chern
 * @Date: 2023/7/12
 * @Time: 9:18
 */

namespace app\middleware;

use app\service\Rsa as RsaServer;
use think\facade\Session;

class Rsa
{
    /**
     * 重复提交判断
     *
     * @param \think\Request $request
     * @param \Closure $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        $rsaModel = new RsaServer();

//        $arr = json_decode($rsaModel->privateDecrypt($request->param('data')),true);

        $arr = $request->param();

        $arr = $arr ? $arr : [];

        if($request->isPost()){

            $request->withPost($arr);

        }elseif($request->isGet()){

            $request->withGet($arr);

        }
        return $next($request);
    }
}